<?php
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) {
    header("Content-type:application/pdf");
    header("Content-Disposition:attachment;filename='downloaded.pdf'");
}else{
    $url = 'http://www.baidu.com';
    header('location:'.$url);
}
?>